#include  "integrationformulaline.h"

using namespace std;

/*------------------------------------------------------------*/

LineTrapez::LineTrapez()
  : IntegrationFormulaBase(2)
{
  w(0) = 0.5;
  w(1) = 0.5;
  c(0) = 0.;
  c(1) = 1.;
}

/*------------------------------------------------------------*/

LineSimpson::LineSimpson()
  : IntegrationFormulaBase(3)
{
  w(0) = 0.1666666666666666666;
  w(1) = 0.6666666666666666666;
  w(2) = 0.1666666666666666666;
  c(0) = 0. ;
  c(1) = 0.5;
  c(2) = 1. ;
}
/*------------------------------------------------------------*/

LineGauss1::LineGauss1() 
  : IntegrationFormulaBase(1)
{
  w(0) = 1.;
  c(0) = 0.5;
}

/*------------------------------------------------------------*/

LineGauss2::LineGauss2() 
  : IntegrationFormulaBase(2)
{
  w(0) = 0.5;
  w(1) = 0.5;
  c(0) = 0.21132486540518711775;
  c(1) = 0.78867513459481288225;
}

/*------------------------------------------------------------*/

LineGauss3::LineGauss3() 
  : IntegrationFormulaBase(3)
{
  c(0) = 0.11270166537925831148;
  c(1) = 0.5;
  c(2) = 0.88729833462074168852;
  
  w(0) =0.277777777778;
  w(1) =0.444444444444; 
  w(2) =0.277777777778; 
}

/*------------------------------------------------------------*/

LineGauss4::LineGauss4() 
  : IntegrationFormulaBase(4)
{
  c(0) =0.069431844203; 
  c(1) =0.330009478208;
  c(2) =0.669990521792;
  c(3) =0.930568155797;
  
  w(0) =0.173927422569;
  w(1) =0.326072577431; 
  w(2) =0.326072577431; 
  w(3) =0.173927422569; 
}

/*------------------------------------------------------------*/

LineGauss5::LineGauss5() 
  : IntegrationFormulaBase(5)
{
  c(0) = 0.0469100770307; 
  c(1) = 0.230765344947;
  c(2) = 0.5;
  c(3) = 0.769234655053;
  c(4) = 0.953089922969;
  
  w(0) = 0.118463442528;
  w(1) = 0.23931433525; 
  w(2) = 0.284444444444; 
  w(3) = 0.23931433525; 
  w(4) = 0.118463442528; 
}

/*------------------------------------------------------------*/

LineGauss6::LineGauss6() 
  : IntegrationFormulaBase(6)
{
  c(0) = .03376524289842398608;
  c(1) = .16939530676686774318;
  c(2) = .38069040695840154568;
  c(3) = .61930959304159845432;
  c(4) = .83060469323313225682;
  c(5) = .96623475710157601392;
  
  double d = 1./sqrt(0.0073380204222450993933);
  w(0) = d * 0.0073380204222450993933;
  w(1) = d * 0.015451823343095832149;
  w(2) = d * 0.020041279329451654676;
  w(3) = d * 0.020041279329451654676;
  w(4) = d * 0.015451823343095832149;
  w(5) = d * 0.0073380204222450993933;
}

/*------------------------------------------------------------*/

LineGauss7::LineGauss7() 
  : IntegrationFormulaBase(7)
{
  c(0) = .02544604382862073773;
  c(1) = .12923440720030278006;
  c(2) = .29707742431130141655;
  c(3) = .5;
  c(4) = .70292257568869858345;
  c(5) = .87076559279969721994;
  c(6) = .97455395617137926227;

  double d = 1./sqrt(0.0041915891159383322640);
  w(0) = d * .0041915891159383322640;
  w(1) = d * .0090544107885598605998;
  w(2) = d * .012360312792978283247;
  w(3) = d * .013529857689481894499;
  w(4) = d * .012360312792978283247;
  w(5) = d * .0090544107885598605998;
  w(6) = d * .0041915891159383322640;
}

/*------------------------------------------------------------*/

LineGauss8::LineGauss8() 
  : IntegrationFormulaBase(8)
{
  assert(0);
}

/*------------------------------------------------------------*/

LineGauss9::LineGauss9() 
  : IntegrationFormulaBase(9)
{
  c(0) = .01591988024618695508;
  c(1) = .08198444633668210283;
  c(2) = .19331428364970480135;
  c(3) = .33787328829809553548;
  c(4) = .5;
  c(5) = .66212671170190446452;
  c(6) = .80668571635029519865;
  c(7) = .91801555366331789717;
  c(8) = .98408011975381304492;

  double d = 1./sqrt(.0016513815508870055422);
  w(0) = d * .0016513815508870055422;
  w(1) = d * .0036705171922794856688;
  w(2) = d * .0052952437376581350733;
  w(3) = d * .0063464544107379482363;
  w(4) = d * .0067100003976620567378;
  w(5) = d * .0063464544107379482363;
  w(6) = d * .0052952437376581350733;
  w(7) = d * .0036705171922794856688;
  w(8) = d * .0016513815508870055422;
}

/*------------------------------------------------------------*/

LineGauss10::LineGauss10() 
  : IntegrationFormulaBase(10)
{
  c(0) = .01304673575;
  c(1) = .06746831665;
  c(2) = .16029521585;
  c(3) = .28330230295;
  c(4) = .42556283050;
  c(5) = .57443716950;
  c(6) = .71669769705;
  c(7) = .83970478415;
  c(8) = .93253168335;
  c(9) = .98695326425;

  double d = 1./sqrt( .0011112670466415998052);
  w(0) = d * .0011112670466415998052;
  w(1) = d * .0024910305977280679248;
  w(2) = d * .0036516955913344794730;
  w(3) = d * .0044880935568244855958;
  w(4) = d * .0049257493534058106410;
  w(5) = d * .0049257493534058106410;
  w(6) = d * .0044880935568244855958;
  w(7) = d * .0036516955913344794730;
  w(8) = d * .0024910305977280679248;
  w(9) = d * .0011112670466415998052;
}

